﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ex5
{
    class Program
    {
        static void Main(string[] args)
        {
            Hero heroOne = new Hero();
            heroOne.AddLife();
            heroOne.Life = 90;
            int k = heroOne.Life;
        }
    }
    class Hero
    {
        private string name;
        private int life=50;

        public int Life
        {
            get
            {
                return life;
            }
            set
            {
                if (value < 0)
                    life = 0;
                else
                {
                    if (value > 100)
                        life = 100;
                    else
                        life = value;
                }

            }
        }

        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
            }
        }

        public int Age { get; set; }
        public void AddLife()
        {
            life++;
        }
        public Hero()
        {
            life = 0;
            name = "";
        }
        ~Hero()
        { }
    }
    
}
